'''
Created on Apr 7, 2011

@author: Tyler
'''
import orange
if __name__ == '__main__':
    pass

train_data = orange.ExampleTable("../train")
test_data = orange.ExampleTable("../test")

knn = orange.kNNLearner()
knn.k = 5
#knn.distanceConstructor = orange.ExamplesDistanceConstructor_Relief()
knn.distanceConstructor = orange.ExamplesDistanceConstructor_Euclidean()
knn = knn(train_data)
#for i in range(len(test_data)):
#    d = test_data[i]
#    c = knn(d)
#    print "original", test_data[i].getclass(), "classified as", c

x = orange.Example(test_data[0].domain, [0.000157064642811049,
                                         0.000618664259683076,
                                         0.0009066023059617201,
                                         -3.5648139668749816e-07,
                                         1.1857080124789941e-05,
                                         -9.919293627065475e-06,
                                         7.315477864519514e-05,
                                         'confusion'])
c = knn(x)
print "original", x.getclass(), "classified as", c
